﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="corp_list.aspx.cs" Inherits="Web.Admin.Corp.corp_list" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>

</head>
<body>
    <form id="form1" runat="server">
     <div>
<label>所在城市：</label>
      <asp:DropDownList ID="ddlArea" runat="server" DataSourceID="sdsAreaList" 
                        DataTextField="AreaName" DataValueField="AreaID"  AutoPostBack="True">
                    </asp:DropDownList>
                      <label style="margin-left:10px">商家类别：</label>
                  <asp:DropDownList ID="ddlCorpType" runat="server"   AutoPostBack="True">
                   <asp:ListItem Value="0">所有类别</asp:ListItem>
                        <asp:ListItem Value="1">餐饮美食</asp:ListItem>
                        <asp:ListItem Value="2">夜场酒吧</asp:ListItem>
                        <asp:ListItem Value="3">娱乐休闲</asp:ListItem>
                        <asp:ListItem Value="4">旅游度假</asp:ListItem>
                        <asp:ListItem Value="5">时尚购物</asp:ListItem>
                    </asp:DropDownList>
            <br />
            
    <pan:SmartGridView ID="gdvInfoList" runat="server"  
            AllowPaging="True" AllowSorting="True"  AutoGenerateColumns="False" DataSourceID="sdsCorpList"
        PageSize="15"  BorderWidth="1px" BackColor="White" 
            BorderColor="#999999" BorderStyle="None" CellPadding="3" 
             GridLines="Vertical" >
         <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
         <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
        <Columns>
               
                <asp:HyperLinkField DataNavigateUrlFields="CorpID" 
                    DataNavigateUrlFormatString="Corp_detail.aspx?id={0}" 
                    DataTextField="Title" HeaderText="商户名称" SortExpression="Title" />
                <asp:BoundField DataField="UserName" HeaderText="所属用户" 
                    SortExpression="UserName" />
   
                <asp:BoundField DataField="TvCount" HeaderText="视频数量" 
                    SortExpression="TvCount" />
                    <asp:TemplateField HeaderText="上传视频">
                    <ItemTemplate> 
                    <a     onclick="javascript:window.open('Tv_new.aspx?id=<%# Eval("CorpID") %>', '', 'width=300,height=150,resizable=0,scrollbars=no');" style="cursor:hand; color:Green">上传视频</a>
                   
                  <%--<a href='Tv_new.aspx?id=<%# Eval("CorpID") %>' target="_blank">ddd</a>--%>
                   </ItemTemplate>
                    </asp:TemplateField>
                   <asp:TemplateField HeaderText="上传图片">
                    <ItemTemplate> 
                    <a     onclick="javascript:window.open('Image_new.aspx?id=<%# Eval("CorpID") %>', '', 'width=300,height=150,resizable=0,scrollbars=no');" style="cursor:hand; color:Blue">上传图片</a>
                  <%--<a href='Tv_new.aspx?id=<%# Eval("CorpID") %>' target="_blank">ddd</a>--%>
                   </ItemTemplate>
                    </asp:TemplateField>
            
                     <asp:HyperLinkField DataNavigateUrlFields="CorpID,Title" 
                    DataNavigateUrlFormatString="../coupon_list.aspx?id={0}&title={1}" 
                    Text="优惠券列表"  HeaderText="优惠券管理" />
                    
        </Columns>
         <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
        <EmptyDataTemplate>
        <div style='text-align:left;margin-left:20px;line-height:20px;margin-bottom:10px;'>
		   <p style='color:#FF4E00;font-size:14px;font-weight:bold;'> 抱歉！没有搜索到相关信息 ！<br /><br /></p>

			可能的原因有：<br />
			1、城市和类型不匹配<br />
			2、没有满足搜索条件的信息。<br /></div>
        
        </EmptyDataTemplate>
         <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
        <CustomPagerSettings PagingMode="Webabcd" TextFormat="每页{0}条/共{1}条  第{2}页/共{3}页   " />
        <PagerSettings Position="Bottom" PageButtonCount="13" FirstPageText="首页" PreviousPageText="上一页"
            NextPageText="下一页" LastPageText="末页" />
         <AlternatingRowStyle BackColor="#DCDCDC" />
         <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
    </pan:SmartGridView>	  
    
           <asp:SqlDataSource ID="sdsAreaList" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT 0 as  [AreaID], '所有城市' as [AreaName],1 as  [Deep] 
union all
SELECT [AreaID], [AreaName], [Deep] FROM [Sys_Area] WHERE ([Deep] = @Deep)" >
                        <SelectParameters>
                            <asp:Parameter DefaultValue="1" Name="Deep" Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
            
            <asp:SqlDataSource ID="sdsCorpList" runat="server" 
             ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
             
             SelectCommand="select Title,username,CorpID,(select count(videoid) from CorpVideo where CorpVideo.CorpID=CorpInfo.CorpID ) as TvCount from CorpInfo where(@AreaID=0 or AreaID=@AreaID) and (@CorpTypeID = 0 or TypeID = @CorpTypeID )order by Sort,CreateOn desc">
                <SelectParameters>
                    <asp:ControlParameter ControlID="ddlArea" Name="AreaID" 
                        PropertyName="SelectedValue" />
                    <asp:ControlParameter ControlID="ddlCorpType" Name="CorpTypeID" 
                        PropertyName="SelectedValue" />
                </SelectParameters>
         </asp:SqlDataSource>
            
            <br />
            
    </div>
    </form>
</body>
</html>
